/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020.
 * Description	: create block devices on RAM
 *					  pramdisk with dax should be formated like "-b PAGE_SIZE"
 * File Name	: pramdisk.c
 * Version	: Initial Draft
 * Author	: lizhe
 * Create	: 2020/10/23
 * history	: 2020/10/23 init
 */

#include <linux/gfp.h>

#ifdef CONFIG_X86
#include <asm/e820/api.h>
#endif

#include <linux/rtos_pfn_valid.h>

int pfn_in_kernel_ram(unsigned long pfn_min, unsigned long pfn_max)
{
	int rc = 0;

#ifdef CONFIG_X86
	if (!mem_range_in_reserve_area(pfn_min << PAGE_SHIFT, pfn_max << PAGE_SHIFT))
		rc = 1;
#else
	if (rtos_pfn_valid(pfn_min) || rtos_pfn_valid(pfn_max))
		rc = 1;
#endif
	return rc;
}
EXPORT_SYMBOL(pfn_in_kernel_ram);
